package com.zhao.dome01.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfig {

    //TODO 这里的备注还没有写
    @Bean
    public OpenAPI dome01OpenAPI() {
        return new OpenAPI()
                .info(new Info().title("二次元聚集地")
                        .description("二次元聚集地文档")
                        .version("1.0.0")
                        .contact(new Contact().name("萤石眼").email("2239531240@qq.com")))
                .externalDocs(new ExternalDocumentation()
                        .description("测试")
                        .url("https://localhost:8080"));
    }
    //TODO 分组功能还没有
    @Bean
    public GroupedOpenApi userGroupAPI() {
        return GroupedOpenApi.builder().group("user").displayName("用户")
                .addOpenApiCustomizer(openApi -> openApi.info(new Info().title("用户测试组").version("1.0.0")))
                .packagesToScan("com.zhao.dome01.controller.userController")
                .pathsToMatch("/user")
                .build();
    }
}
